#include "DetourTileCacheBuilder.h"
#ifdef __cplusplus
extern "C" {
#endif
void * nav_dtTileCacheAlloc_alloc(dtTileCacheAlloc * c_this,size_t const size){
	size_t const c_arg_size=size;
	void * c_out = c_this->alloc(c_arg_size);
	void * wrap_out  = (void *)(void*)(c_out);
	return wrap_out;
}

void nav_dtTileCacheAlloc_Delete(dtTileCacheAlloc * c_this){
	if(c_this==0){
	    return;
	}
	delete c_this;
}

void nav_dtTileCacheAlloc_DeleteArray(dtTileCacheAlloc * c_this){
	if(c_this==0){
		return;
	}
	delete []c_this;
}

dtTileCacheAlloc * nav_NewdtTileCacheAlloc(){
	dtTileCacheAlloc* wrap_out = new dtTileCacheAlloc();
	return wrap_out;
}

void nav_dtTileCacheAlloc_free(dtTileCacheAlloc * c_this,void * ptr){
	void * c_arg_ptr=(void *)(void*)(ptr);
	c_this->free(c_arg_ptr);
}

dtTileCacheAlloc * nav_dtTileCacheAlloc_IndexArray(dtTileCacheAlloc * c_this,long n){
	if(c_this==0){
		return 0;
	}
	c_this+=n;
	return c_this;
}

void nav_dtTileCacheAlloc_reset(dtTileCacheAlloc * c_this){
	c_this->reset();
}

dtStatus nav_dtTileCacheCompressor_compress(dtTileCacheCompressor * c_this,unsigned char const * buffer,int const bufferSize,unsigned char * compressed,int const maxCompressedSize,int * compressedSize){
	unsigned char const * c_arg_buffer=(unsigned char const *)(void*)(buffer);
	int const c_arg_bufferSize=bufferSize;
	unsigned char * c_arg_compressed=(unsigned char *)(void*)(compressed);
	int const c_arg_maxCompressedSize=maxCompressedSize;
	int * c_arg_compressedSize=(int *)(void*)(compressedSize);
	dtStatus c_out = c_this->compress(c_arg_buffer,c_arg_bufferSize,c_arg_compressed,c_arg_maxCompressedSize,c_arg_compressedSize);
	dtStatus wrap_out  = (c_out);
	return wrap_out;
}

dtStatus nav_dtTileCacheCompressor_decompress(dtTileCacheCompressor * c_this,unsigned char const * compressed,int const compressedSize,unsigned char * buffer,int const maxBufferSize,int * bufferSize){
	unsigned char const * c_arg_compressed=(unsigned char const *)(void*)(compressed);
	int const c_arg_compressedSize=compressedSize;
	unsigned char * c_arg_buffer=(unsigned char *)(void*)(buffer);
	int const c_arg_maxBufferSize=maxBufferSize;
	int * c_arg_bufferSize=(int *)(void*)(bufferSize);
	dtStatus c_out = c_this->decompress(c_arg_compressed,c_arg_compressedSize,c_arg_buffer,c_arg_maxBufferSize,c_arg_bufferSize);
	dtStatus wrap_out  = (c_out);
	return wrap_out;
}

void nav_dtTileCacheCompressor_Delete(dtTileCacheCompressor * c_this){
	if(c_this==0){
	    return;
	}
	delete c_this;
}

int nav_dtTileCacheCompressor_maxCompressedSize(dtTileCacheCompressor * c_this,int const bufferSize){
	int const c_arg_bufferSize=bufferSize;
	int c_out = c_this->maxCompressedSize(c_arg_bufferSize);
	int wrap_out  = (c_out);
	return wrap_out;
}

void nav_dtTileCacheContour_Delete(dtTileCacheContour * c_this){
	if(c_this==0){
	    return;
	}
	delete c_this;
}

void nav_dtTileCacheContour_DeleteArray(dtTileCacheContour * c_this){
	if(c_this==0){
		return;
	}
	delete []c_this;
}

dtTileCacheContour * nav_NewdtTileCacheContour(){
	dtTileCacheContour* wrap_out = new dtTileCacheContour();
	return wrap_out;
}

unsigned char * nav_dtTileCacheContour_GetPtrToArea(dtTileCacheContour * c_this){
	return (unsigned char *)(&(c_this->area));
}

int * nav_dtTileCacheContour_GetPtrToNverts(dtTileCacheContour * c_this){
	return (int *)(&(c_this->nverts));
}

unsigned char * nav_dtTileCacheContour_GetPtrToReg(dtTileCacheContour * c_this){
	return (unsigned char *)(&(c_this->reg));
}

unsigned char * * nav_dtTileCacheContour_GetPtrToVerts(dtTileCacheContour * c_this){
	return (unsigned char * *)(&(c_this->verts));
}

dtTileCacheContour * nav_dtTileCacheContour_IndexArray(dtTileCacheContour * c_this,long n){
	if(c_this==0){
		return 0;
	}
	c_this+=n;
	return c_this;
}

void nav_dtTileCacheContourSet_Delete(dtTileCacheContourSet * c_this){
	if(c_this==0){
	    return;
	}
	delete c_this;
}

void nav_dtTileCacheContourSet_DeleteArray(dtTileCacheContourSet * c_this){
	if(c_this==0){
		return;
	}
	delete []c_this;
}

dtTileCacheContourSet * nav_NewdtTileCacheContourSet(){
	dtTileCacheContourSet* wrap_out = new dtTileCacheContourSet();
	return wrap_out;
}

dtTileCacheContour * * nav_dtTileCacheContourSet_GetPtrToConts(dtTileCacheContourSet * c_this){
	return (dtTileCacheContour * *)(&(c_this->conts));
}

int * nav_dtTileCacheContourSet_GetPtrToNconts(dtTileCacheContourSet * c_this){
	return (int *)(&(c_this->nconts));
}

dtTileCacheContourSet * nav_dtTileCacheContourSet_IndexArray(dtTileCacheContourSet * c_this,long n){
	if(c_this==0){
		return 0;
	}
	c_this+=n;
	return c_this;
}

void nav_dtTileCacheLayer_Delete(dtTileCacheLayer * c_this){
	if(c_this==0){
	    return;
	}
	delete c_this;
}

void nav_dtTileCacheLayer_DeleteArray(dtTileCacheLayer * c_this){
	if(c_this==0){
		return;
	}
	delete []c_this;
}

dtTileCacheLayer * nav_NewdtTileCacheLayer(){
	dtTileCacheLayer* wrap_out = new dtTileCacheLayer();
	return wrap_out;
}

unsigned char * * nav_dtTileCacheLayer_GetPtrToAreas(dtTileCacheLayer * c_this){
	return (unsigned char * *)(&(c_this->areas));
}

unsigned char * * nav_dtTileCacheLayer_GetPtrToCons(dtTileCacheLayer * c_this){
	return (unsigned char * *)(&(c_this->cons));
}

dtTileCacheLayerHeader * * nav_dtTileCacheLayer_GetPtrToHeader(dtTileCacheLayer * c_this){
	return (dtTileCacheLayerHeader * *)(&(c_this->header));
}

unsigned char * * nav_dtTileCacheLayer_GetPtrToHeights(dtTileCacheLayer * c_this){
	return (unsigned char * *)(&(c_this->heights));
}

unsigned char * nav_dtTileCacheLayer_GetPtrToRegCount(dtTileCacheLayer * c_this){
	return (unsigned char *)(&(c_this->regCount));
}

unsigned char * * nav_dtTileCacheLayer_GetPtrToRegs(dtTileCacheLayer * c_this){
	return (unsigned char * *)(&(c_this->regs));
}

dtTileCacheLayer * nav_dtTileCacheLayer_IndexArray(dtTileCacheLayer * c_this,long n){
	if(c_this==0){
		return 0;
	}
	c_this+=n;
	return c_this;
}

void nav_dtTileCacheLayerHeader_Delete(dtTileCacheLayerHeader * c_this){
	if(c_this==0){
	    return;
	}
	delete c_this;
}

void nav_dtTileCacheLayerHeader_DeleteArray(dtTileCacheLayerHeader * c_this){
	if(c_this==0){
		return;
	}
	delete []c_this;
}

dtTileCacheLayerHeader * nav_NewdtTileCacheLayerHeader(){
	dtTileCacheLayerHeader* wrap_out = new dtTileCacheLayerHeader();
	return wrap_out;
}

float(*nav_dtTileCacheLayerHeader_GetPtrToBmax(dtTileCacheLayerHeader * c_this))[3]{
	return (float(*)[3])(&(c_this->bmax));
}

float(*nav_dtTileCacheLayerHeader_GetPtrToBmin(dtTileCacheLayerHeader * c_this))[3]{
	return (float(*)[3])(&(c_this->bmin));
}

unsigned char * nav_dtTileCacheLayerHeader_GetPtrToHeight(dtTileCacheLayerHeader * c_this){
	return (unsigned char *)(&(c_this->height));
}

unsigned short * nav_dtTileCacheLayerHeader_GetPtrToHmax(dtTileCacheLayerHeader * c_this){
	return (unsigned short *)(&(c_this->hmax));
}

unsigned short * nav_dtTileCacheLayerHeader_GetPtrToHmin(dtTileCacheLayerHeader * c_this){
	return (unsigned short *)(&(c_this->hmin));
}

int * nav_dtTileCacheLayerHeader_GetPtrToMagic(dtTileCacheLayerHeader * c_this){
	return (int *)(&(c_this->magic));
}

unsigned char * nav_dtTileCacheLayerHeader_GetPtrToMaxx(dtTileCacheLayerHeader * c_this){
	return (unsigned char *)(&(c_this->maxx));
}

unsigned char * nav_dtTileCacheLayerHeader_GetPtrToMaxy(dtTileCacheLayerHeader * c_this){
	return (unsigned char *)(&(c_this->maxy));
}

unsigned char * nav_dtTileCacheLayerHeader_GetPtrToMinx(dtTileCacheLayerHeader * c_this){
	return (unsigned char *)(&(c_this->minx));
}

unsigned char * nav_dtTileCacheLayerHeader_GetPtrToMiny(dtTileCacheLayerHeader * c_this){
	return (unsigned char *)(&(c_this->miny));
}

int * nav_dtTileCacheLayerHeader_GetPtrToTlayer(dtTileCacheLayerHeader * c_this){
	return (int *)(&(c_this->tlayer));
}

int * nav_dtTileCacheLayerHeader_GetPtrToTx(dtTileCacheLayerHeader * c_this){
	return (int *)(&(c_this->tx));
}

int * nav_dtTileCacheLayerHeader_GetPtrToTy(dtTileCacheLayerHeader * c_this){
	return (int *)(&(c_this->ty));
}

int * nav_dtTileCacheLayerHeader_GetPtrToVersion(dtTileCacheLayerHeader * c_this){
	return (int *)(&(c_this->version));
}

unsigned char * nav_dtTileCacheLayerHeader_GetPtrToWidth(dtTileCacheLayerHeader * c_this){
	return (unsigned char *)(&(c_this->width));
}

dtTileCacheLayerHeader * nav_dtTileCacheLayerHeader_IndexArray(dtTileCacheLayerHeader * c_this,long n){
	if(c_this==0){
		return 0;
	}
	c_this+=n;
	return c_this;
}

void nav_dtTileCachePolyMesh_Delete(dtTileCachePolyMesh * c_this){
	if(c_this==0){
	    return;
	}
	delete c_this;
}

void nav_dtTileCachePolyMesh_DeleteArray(dtTileCachePolyMesh * c_this){
	if(c_this==0){
		return;
	}
	delete []c_this;
}

dtTileCachePolyMesh * nav_NewdtTileCachePolyMesh(){
	dtTileCachePolyMesh* wrap_out = new dtTileCachePolyMesh();
	return wrap_out;
}

unsigned char * * nav_dtTileCachePolyMesh_GetPtrToAreas(dtTileCachePolyMesh * c_this){
	return (unsigned char * *)(&(c_this->areas));
}

unsigned short * * nav_dtTileCachePolyMesh_GetPtrToFlags(dtTileCachePolyMesh * c_this){
	return (unsigned short * *)(&(c_this->flags));
}

int * nav_dtTileCachePolyMesh_GetPtrToNpolys(dtTileCachePolyMesh * c_this){
	return (int *)(&(c_this->npolys));
}

int * nav_dtTileCachePolyMesh_GetPtrToNverts(dtTileCachePolyMesh * c_this){
	return (int *)(&(c_this->nverts));
}

int * nav_dtTileCachePolyMesh_GetPtrToNvp(dtTileCachePolyMesh * c_this){
	return (int *)(&(c_this->nvp));
}

unsigned short * * nav_dtTileCachePolyMesh_GetPtrToPolys(dtTileCachePolyMesh * c_this){
	return (unsigned short * *)(&(c_this->polys));
}

unsigned short * * nav_dtTileCachePolyMesh_GetPtrToVerts(dtTileCachePolyMesh * c_this){
	return (unsigned short * *)(&(c_this->verts));
}

dtTileCachePolyMesh * nav_dtTileCachePolyMesh_IndexArray(dtTileCachePolyMesh * c_this,long n){
	if(c_this==0){
		return 0;
	}
	c_this+=n;
	return c_this;
}

dtTileCacheContourSet * nav_dtAllocTileCacheContourSet(dtTileCacheAlloc * alloc){
	dtTileCacheAlloc * c_arg_alloc=(dtTileCacheAlloc *)(void*)(alloc);
	dtTileCacheContourSet * c_out = dtAllocTileCacheContourSet(c_arg_alloc);
	dtTileCacheContourSet * wrap_out  = (dtTileCacheContourSet *)(void*)(c_out);
	return wrap_out;
}

dtTileCachePolyMesh * nav_dtAllocTileCachePolyMesh(dtTileCacheAlloc * alloc){
	dtTileCacheAlloc * c_arg_alloc=(dtTileCacheAlloc *)(void*)(alloc);
	dtTileCachePolyMesh * c_out = dtAllocTileCachePolyMesh(c_arg_alloc);
	dtTileCachePolyMesh * wrap_out  = (dtTileCachePolyMesh *)(void*)(c_out);
	return wrap_out;
}

dtStatus nav_dtBuildTileCacheContours(dtTileCacheAlloc * alloc,dtTileCacheLayer * layer,int const walkableClimb,float const maxError,dtTileCacheContourSet * lcset){
	dtTileCacheAlloc * c_arg_alloc=(dtTileCacheAlloc *)(void*)(alloc);
	dtTileCacheLayer& c_arg_layer=*(dtTileCacheLayer *)(layer);
	int const c_arg_walkableClimb=walkableClimb;
	float const c_arg_maxError=maxError;
	dtTileCacheContourSet& c_arg_lcset=*(dtTileCacheContourSet *)(lcset);
	dtStatus c_out = dtBuildTileCacheContours(c_arg_alloc,c_arg_layer,c_arg_walkableClimb,c_arg_maxError,c_arg_lcset);
	dtStatus wrap_out  = (c_out);
	return wrap_out;
}

dtStatus nav_dtBuildTileCacheLayer(dtTileCacheCompressor * comp,dtTileCacheLayerHeader * header,unsigned char const * heights,unsigned char const * areas,unsigned char const * cons,unsigned char * * outData,int * outDataSize){
	dtTileCacheCompressor * c_arg_comp=(dtTileCacheCompressor *)(void*)(comp);
	dtTileCacheLayerHeader * c_arg_header=(dtTileCacheLayerHeader *)(void*)(header);
	unsigned char const * c_arg_heights=(unsigned char const *)(void*)(heights);
	unsigned char const * c_arg_areas=(unsigned char const *)(void*)(areas);
	unsigned char const * c_arg_cons=(unsigned char const *)(void*)(cons);
	unsigned char * * c_arg_outData=(unsigned char * *)(void*)(outData);
	int * c_arg_outDataSize=(int *)(void*)(outDataSize);
	dtStatus c_out = dtBuildTileCacheLayer(c_arg_comp,c_arg_header,c_arg_heights,c_arg_areas,c_arg_cons,c_arg_outData,c_arg_outDataSize);
	dtStatus wrap_out  = (c_out);
	return wrap_out;
}

dtStatus nav_dtBuildTileCachePolyMesh(dtTileCacheAlloc * alloc,dtTileCacheContourSet * lcset,dtTileCachePolyMesh * mesh){
	dtTileCacheAlloc * c_arg_alloc=(dtTileCacheAlloc *)(void*)(alloc);
	dtTileCacheContourSet& c_arg_lcset=*(dtTileCacheContourSet *)(lcset);
	dtTileCachePolyMesh& c_arg_mesh=*(dtTileCachePolyMesh *)(mesh);
	dtStatus c_out = dtBuildTileCachePolyMesh(c_arg_alloc,c_arg_lcset,c_arg_mesh);
	dtStatus wrap_out  = (c_out);
	return wrap_out;
}

dtStatus nav_dtBuildTileCacheRegions(dtTileCacheAlloc * alloc,dtTileCacheLayer * layer,int const walkableClimb){
	dtTileCacheAlloc * c_arg_alloc=(dtTileCacheAlloc *)(void*)(alloc);
	dtTileCacheLayer& c_arg_layer=*(dtTileCacheLayer *)(layer);
	int const c_arg_walkableClimb=walkableClimb;
	dtStatus c_out = dtBuildTileCacheRegions(c_arg_alloc,c_arg_layer,c_arg_walkableClimb);
	dtStatus wrap_out  = (c_out);
	return wrap_out;
}

dtStatus nav_dtDecompressTileCacheLayer(dtTileCacheAlloc * alloc,dtTileCacheCompressor * comp,unsigned char * compressed,int const compressedSize,dtTileCacheLayer * * layerOut){
	dtTileCacheAlloc * c_arg_alloc=(dtTileCacheAlloc *)(void*)(alloc);
	dtTileCacheCompressor * c_arg_comp=(dtTileCacheCompressor *)(void*)(comp);
	unsigned char * c_arg_compressed=(unsigned char *)(void*)(compressed);
	int const c_arg_compressedSize=compressedSize;
	dtTileCacheLayer * * c_arg_layerOut=(dtTileCacheLayer * *)(void*)(layerOut);
	dtStatus c_out = dtDecompressTileCacheLayer(c_arg_alloc,c_arg_comp,c_arg_compressed,c_arg_compressedSize,c_arg_layerOut);
	dtStatus wrap_out  = (c_out);
	return wrap_out;
}

void nav_dtFreeTileCacheContourSet(dtTileCacheAlloc * alloc,dtTileCacheContourSet * cset){
	dtTileCacheAlloc * c_arg_alloc=(dtTileCacheAlloc *)(void*)(alloc);
	dtTileCacheContourSet * c_arg_cset=(dtTileCacheContourSet *)(void*)(cset);
	dtFreeTileCacheContourSet(c_arg_alloc,c_arg_cset);
}

void nav_dtFreeTileCacheLayer(dtTileCacheAlloc * alloc,dtTileCacheLayer * layer){
	dtTileCacheAlloc * c_arg_alloc=(dtTileCacheAlloc *)(void*)(alloc);
	dtTileCacheLayer * c_arg_layer=(dtTileCacheLayer *)(void*)(layer);
	dtFreeTileCacheLayer(c_arg_alloc,c_arg_layer);
}

void nav_dtFreeTileCachePolyMesh(dtTileCacheAlloc * alloc,dtTileCachePolyMesh * lmesh){
	dtTileCacheAlloc * c_arg_alloc=(dtTileCacheAlloc *)(void*)(alloc);
	dtTileCachePolyMesh * c_arg_lmesh=(dtTileCachePolyMesh *)(void*)(lmesh);
	dtFreeTileCachePolyMesh(c_arg_alloc,c_arg_lmesh);
}

dtStatus nav_dtMarkBoxArea(dtTileCacheLayer * layer,float const * orig,float const cs,float const ch,float const * bmin,float const * bmax,unsigned char const areaId){
	dtTileCacheLayer& c_arg_layer=*(dtTileCacheLayer *)(layer);
	float const * c_arg_orig=(float const *)(void*)(orig);
	float const c_arg_cs=cs;
	float const c_arg_ch=ch;
	float const * c_arg_bmin=(float const *)(void*)(bmin);
	float const * c_arg_bmax=(float const *)(void*)(bmax);
	unsigned char const c_arg_areaId=areaId;
	dtStatus c_out = dtMarkBoxArea(c_arg_layer,c_arg_orig,c_arg_cs,c_arg_ch,c_arg_bmin,c_arg_bmax,c_arg_areaId);
	dtStatus wrap_out  = (c_out);
	return wrap_out;
}

dtStatus nav_dtMarkBoxArea11(dtTileCacheLayer * layer,float const * orig,float const cs,float const ch,float const * center,float const * halfExtents,float const * rotAux,unsigned char const areaId){
	dtTileCacheLayer& c_arg_layer=*(dtTileCacheLayer *)(layer);
	float const * c_arg_orig=(float const *)(void*)(orig);
	float const c_arg_cs=cs;
	float const c_arg_ch=ch;
	float const * c_arg_center=(float const *)(void*)(center);
	float const * c_arg_halfExtents=(float const *)(void*)(halfExtents);
	float const * c_arg_rotAux=(float const *)(void*)(rotAux);
	unsigned char const c_arg_areaId=areaId;
	dtStatus c_out = dtMarkBoxArea(c_arg_layer,c_arg_orig,c_arg_cs,c_arg_ch,c_arg_center,c_arg_halfExtents,c_arg_rotAux,c_arg_areaId);
	dtStatus wrap_out  = (c_out);
	return wrap_out;
}

dtStatus nav_dtMarkCylinderArea(dtTileCacheLayer * layer,float const * orig,float const cs,float const ch,float const * pos,float const radius,float const height,unsigned char const areaId){
	dtTileCacheLayer& c_arg_layer=*(dtTileCacheLayer *)(layer);
	float const * c_arg_orig=(float const *)(void*)(orig);
	float const c_arg_cs=cs;
	float const c_arg_ch=ch;
	float const * c_arg_pos=(float const *)(void*)(pos);
	float const c_arg_radius=radius;
	float const c_arg_height=height;
	unsigned char const c_arg_areaId=areaId;
	dtStatus c_out = dtMarkCylinderArea(c_arg_layer,c_arg_orig,c_arg_cs,c_arg_ch,c_arg_pos,c_arg_radius,c_arg_height,c_arg_areaId);
	dtStatus wrap_out  = (c_out);
	return wrap_out;
}

bool nav_dtTileCacheHeaderSwapEndian(unsigned char * data,int const dataSize){
	unsigned char * c_arg_data=(unsigned char *)(void*)(data);
	int const c_arg_dataSize=dataSize;
	bool c_out = dtTileCacheHeaderSwapEndian(c_arg_data,c_arg_dataSize);
	bool wrap_out  = (c_out);
	return wrap_out;
}

dtTileCacheAlloc * nav_NewDtTileCacheAllocPtrArray(long n){
	dtTileCacheAlloc* c_this=new dtTileCacheAlloc[n];
	return c_this;
}

dtTileCacheContour * nav_NewDtTileCacheContourPtrArray(long n){
	dtTileCacheContour* c_this=new dtTileCacheContour[n];
	return c_this;
}

dtTileCacheContourSet * nav_NewDtTileCacheContourSetPtrArray(long n){
	dtTileCacheContourSet* c_this=new dtTileCacheContourSet[n];
	return c_this;
}

dtTileCacheLayerHeader * nav_NewDtTileCacheLayerHeaderPtrArray(long n){
	dtTileCacheLayerHeader* c_this=new dtTileCacheLayerHeader[n];
	return c_this;
}

dtTileCacheLayer * nav_NewDtTileCacheLayerPtrArray(long n){
	dtTileCacheLayer* c_this=new dtTileCacheLayer[n];
	return c_this;
}

dtTileCachePolyMesh * nav_NewDtTileCachePolyMeshPtrArray(long n){
	dtTileCachePolyMesh* c_this=new dtTileCachePolyMesh[n];
	return c_this;
}

#ifdef __cplusplus
}
#endif
